package gui;

import game.GameBoard;
import gp.HarbingerOfHeuristics;

import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;

@SuppressWarnings("serial")
public class DebugInfo extends JPanel {
    private GameBoard game;
    
    private JLabel player;
    private JLabel enemy;
    
    private JLabel playerDamage;
    private JLabel enemyDamage;
    private JLabel playerAngle;
    private JLabel enemyAngle;
    private JLabel playerVelocity;
    private JLabel enemyVelocity;
    private JLabel playerBullets;
    private JLabel enemyBullets;
    private JLabel enemyEnergy;
    private JLabel enemyBulletTotal;
    private JLabel enemyWastedEnergy;
    private JLabel advancedPlayerAI;
    private JLabel lastWallHit;
    private JLabel nearHits;
    private JLabel currentHeuristic;
    
    private JLabel playerCoords;
    private JLabel enemyCoords;
    
    public DebugInfo(GameBoard game) {
	this.game = game;
	setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
	player = new JLabel("Player");
	playerDamage = new JLabel();
	playerAngle = new JLabel();
	playerVelocity = new JLabel();
	playerBullets = new JLabel();
	advancedPlayerAI = new JLabel();
	playerCoords = new JLabel();
	lastWallHit = new JLabel();
	
	enemy = new JLabel("Enemy");
	enemyDamage = new JLabel();
	enemyAngle = new JLabel();
	enemyVelocity = new JLabel();
	enemyBullets = new JLabel();
	enemyEnergy = new JLabel();
	enemyCoords = new JLabel();
	enemyBulletTotal = new JLabel();
	enemyWastedEnergy = new JLabel();
	nearHits = new JLabel();
	currentHeuristic = new JLabel();
	
	add(player);
	add(playerDamage);
	add(playerAngle);
	add(playerVelocity);
	add(playerBullets);
	add(advancedPlayerAI);
	add(lastWallHit);
	add(playerCoords);
	
	add(new JSeparator());
	
	add(enemy);
	add(enemyDamage);
	add(enemyAngle);
	add(enemyVelocity);
	add(enemyBullets);
	add(enemyCoords);
	add(enemyEnergy);
	add(enemyBulletTotal);
	add(enemyWastedEnergy);
	add(nearHits);
	add(currentHeuristic);
    }
    
    public void update() {
	playerDamage.setText("Damage: " + game.playerDamage);
	enemyDamage.setText("Damage: " + game.enemyDamage);
	playerAngle.setText("Angle: " + Math.toDegrees(game.player.getAngle()));
	enemyAngle.setText("Angle: "+ Math.toDegrees(game.enemy.getAngle()));
	playerVelocity.setText("Velocity: "+ game.player.getVelocity());
	enemyVelocity.setText("Velocity: "+ game.enemy.getVelocity());
	playerBullets.setText("Active Bullets: " + game.playerBullets.size());
	enemyBullets.setText("Active Bullets: " + game.enemyBullets.size());
	enemyEnergy.setText("Energy: " + game.enemy.getEnergy());
	playerCoords.setText("" + game.player.getX() + ", " + game.player.getY());
	enemyCoords.setText("" + game.enemy.getX() + ", " + game.enemy.getY());
	enemyBulletTotal.setText("Total bullets: " + game.enemyBulletsFired);
	enemyWastedEnergy.setText("Wasted Energy: " + game.enemy.getWastedEnergy());
	advancedPlayerAI.setText("Adv. AI: " + game.isAdvancedPlayerAI());
	lastWallHit.setText("Last Wall Hit: " + game.player.getLastHitWall());
	nearHits.setText("Near Hits: "+ game.nearHits);
	currentHeuristic.setText("Heuristic: " + HarbingerOfHeuristics.getHeuristic(game));
    }
    
}
